package com.ruoyi.net.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.net.mapper.BusiL2VpnAlarmoamMapper;
import com.ruoyi.net.domain.BusiL2VpnAlarmoam;
import com.ruoyi.net.service.IBusiL2VpnAlarmoamService;

/**
 * L2VPN一源两宿故障检测OAMService业务层处理
 * 
 * @author tony
 * @date 2025-02-22
 */
@Service
public class BusiL2VpnAlarmoamServiceImpl implements IBusiL2VpnAlarmoamService 
{
    @Autowired
    private BusiL2VpnAlarmoamMapper busiL2VpnAlarmoamMapper;

    /**
     * 查询L2VPN一源两宿故障检测OAM
     * 
     * @param id L2VPN一源两宿故障检测OAM主键
     * @return L2VPN一源两宿故障检测OAM
     */
    @Override
    public BusiL2VpnAlarmoam selectBusiL2VpnAlarmoamById(String id)
    {
        return busiL2VpnAlarmoamMapper.selectBusiL2VpnAlarmoamById(id);
    }

    /**
     * 查询L2VPN一源两宿故障检测OAM列表
     * 
     * @param busiL2VpnAlarmoam L2VPN一源两宿故障检测OAM
     * @return L2VPN一源两宿故障检测OAM
     */
    @Override
    public List<BusiL2VpnAlarmoam> selectBusiL2VpnAlarmoamList(BusiL2VpnAlarmoam busiL2VpnAlarmoam)
    {
        return busiL2VpnAlarmoamMapper.selectBusiL2VpnAlarmoamList(busiL2VpnAlarmoam);
    }

    /**
     * 新增L2VPN一源两宿故障检测OAM
     * 
     * @param busiL2VpnAlarmoam L2VPN一源两宿故障检测OAM
     * @return 结果
     */
    @Override
    public int insertBusiL2VpnAlarmoam(BusiL2VpnAlarmoam busiL2VpnAlarmoam)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(busiL2VpnAlarmoam.getId())) {
            busiL2VpnAlarmoam.setId(uuid);
        }
        if (StringUtils.isEmpty(busiL2VpnAlarmoam.getMeg())) {
            busiL2VpnAlarmoam.setMeg("123456/789ABC/1/2/7"); // 默认meg
        }
        if (StringUtils.isEmpty(busiL2VpnAlarmoam.getMpType())) {
            busiL2VpnAlarmoam.setMpType("mep"); // mip, 默认mep
        }
        if (StringUtils.isEmpty(busiL2VpnAlarmoam.getAps())) {
            busiL2VpnAlarmoam.setAps("disable");
        }
        if (StringUtils.isEmpty(busiL2VpnAlarmoam.getFdi())) {
            busiL2VpnAlarmoam.setFdi("disable");
        }
        if (StringUtils.isEmpty(busiL2VpnAlarmoam.getCsf())) {
            busiL2VpnAlarmoam.setCsf("disable");
        }
        if (StringUtils.isEmpty(busiL2VpnAlarmoam.getCv())) {
            busiL2VpnAlarmoam.setCv("3_33ms");
        }
        if (StringUtils.isEmpty(busiL2VpnAlarmoam.getLspTtl())) {
            busiL2VpnAlarmoam.setLspTtl("255/7");
        }
        return busiL2VpnAlarmoamMapper.insertBusiL2VpnAlarmoam(busiL2VpnAlarmoam);
    }

    /**
     * 修改L2VPN一源两宿故障检测OAM
     * 
     * @param busiL2VpnAlarmoam L2VPN一源两宿故障检测OAM
     * @return 结果
     */
    @Override
    public int updateBusiL2VpnAlarmoam(BusiL2VpnAlarmoam busiL2VpnAlarmoam)
    {
        return busiL2VpnAlarmoamMapper.updateBusiL2VpnAlarmoam(busiL2VpnAlarmoam);
    }

    /**
     * 批量删除L2VPN一源两宿故障检测OAM
     * 
     * @param ids 需要删除的L2VPN一源两宿故障检测OAM主键
     * @return 结果
     */
    @Override
    public int deleteBusiL2VpnAlarmoamByIds(String[] ids)
    {
        return busiL2VpnAlarmoamMapper.deleteBusiL2VpnAlarmoamByIds(ids);
    }

    /**
     * 删除L2VPN一源两宿故障检测OAM信息
     * 
     * @param id L2VPN一源两宿故障检测OAM主键
     * @return 结果
     */
    @Override
    public int deleteBusiL2VpnAlarmoamById(String id)
    {
        return busiL2VpnAlarmoamMapper.deleteBusiL2VpnAlarmoamById(id);
    }
}
